<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"  %>
<!DOCTYPE html>

<head>
    <meta charset="utf-8">
    <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
    <title>大乱斗后台</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width">
    <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <link href="http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/dld/admin/css/template_main.css">
</head>

<body>
	<jsp:include page="../common/header.jsp"></jsp:include>
        <!--/.navbar-collapse -->
        <div class="templatemo-content-wrapper">
            <div class="templatemo-content">
				<form class="form-horizontal"action="adminAddSubmitUsersMngAction" method="post">
				  <div class="form-group">
				    <label for="username" class="col-sm-2 control-label">账号</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="username" name="usersEdit.username" >
				      <div class="alert alert-danger username-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="password" class="col-sm-2 control-label">密码</label>
				    <div class="col-sm-10">
				      <input type="password" class="form-control" id="password" name="usersEdit.password" >
				      <div class="alert alert-danger password-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="rePassword" class="col-sm-2 control-label">密码</label>
				    <div class="col-sm-10">
				      <input type="password" class="form-control" id="rePassword" name="rePassword" >
				      <div class="alert alert-danger rePassword-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="name" class="col-sm-2 control-label">名称</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="name" name="usersEdit.name" >
				      <div class="alert alert-danger name-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="sex" class="col-sm-2 control-label">性别</label>
				    <div class="col-sm-10">
	                    <label class="radio-inline">
	                      <input type="radio" id="sex" value="男" name="usersEdit.sex"> 男
	                    </label>
	                    <label class="radio-inline">
	                      <input type="radio" id="sex" value="女" name="usersEdit.sex"> 女
	                    </label>
	                    <div class="alert alert-danger sex-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="power" class="col-sm-2 control-label">权限</label>
				    <div class="col-sm-10">
	                    <label class="radio-inline">
		                    <input type="radio" id="power" value="0" name="usersEdit.power" > 管理员
	                    </label>
	                    <label class="radio-inline">
		                    <input type="radio" id="power" value="2" name="usersEdit.power" > 用户
	                    </label>
				    </div>
				    <div class="alert alert-danger power-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				  </div>
				  <div class="form-group">
				    <label for="main_type" class="col-sm-2 control-label">属性</label>
				    <div class="col-sm-10">
	                    <label class="radio-inline">
		                    <input type="radio"id="main_type" value="ll" name="usersEdit.gameInfo.main_type" > 力量
	                    </label>
	                    <label class="radio-inline">
		                    <input type="radio"id="main_type" value="mj" name="usersEdit.gameInfo.main_type" > 敏捷
	                    </label>
	                    <label class="radio-inline">
		                    <input type="radio"id="main_type" value="zl" name="usersEdit.gameInfo.main_type" > 智力
	                    </label>
	                    <div class="alert alert-danger main-type-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="hp" class="col-sm-2 control-label">生命</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="hp" name="usersEdit.gameInfo.hp" value="50">
				      <div class="alert alert-danger hp-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="ll" class="col-sm-2 control-label">力量</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="ll" name="usersEdit.gameInfo.ll" value="10">
				      <div class="alert alert-danger ll-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="name" class="col-sm-2 control-label">敏捷</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="mj" name="usersEdit.gameInfo.mj" value="10">
				      <div class="alert alert-danger mj-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="zl" class="col-sm-2 control-label">智力</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="zl" name="usersEdit.gameInfo.zl" value="10">
				      <div class="alert alert-danger zl-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="money" class="col-sm-2 control-label">金钱</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="money" name="usersEdit.gameInfo.money" value="0">
				      <div class="alert alert-danger money-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="get_money" class="col-sm-2 control-label">数量</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="get_money" name="usersEdit.gameInfo.get_money" value="1">
				      <div class="alert alert-danger get-money-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <div class="col-sm-offset-2 col-sm-10">
				      <div onclick="submit()" class="btn btn-default">添加</div>
				      <button class="btn btn-warning" onclick="history.go(-1)">取消</button>
				    </div>
				  </div>
				</form>
            </div>
        </div>
	<jsp:include page="../common/footer.jsp"></jsp:include>
    <script src="http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="/dld/admin/js/template_js.js"></script>
    <script>
    function submit(){
        if($('#username').val().length < 6 || $('#username').val().length >= 18){
        	$('.username-msg').show();
        	$('.username-msg').text('请输入6位到18位的用户名！');
        	return;
        }else{
        	$('.username-msg').hide();
        }
        if($('#password').val().length < 6 || $('#password').val().length > 18){
        	$('.password-msg').show();
        	$('.password-msg').text('请输入6位到18位的密码！');
        	return;
        }else{
        	$('.password-msg').hide();
        }
        if ($('#rePassword').val() != $('#password').val()) {
        	$('.rePassword-msg').show();
        	$('.rePassword-msg').text('两次密码不一致！');
            return;
        }else{
        	$('.rePassword-msg').hide();
        }
        if ($('#name').val().length > 10 || $('#name').val() == "") {
        	$('.name-msg').show();
        	$('.name-msg').text('名称不能超过10位且不能为空！');
            return;
        }else{
        	$('.name-msg').hide();
        }
        if ($('#sex:checked').val() == undefined) {
        	$('.sex-msg').show();
        	$('.sex-msg').text('性别不能为空！');
            return;
        }else{
        	$('.sex-msg').hide();
        }
        if ($('#power:checked').val() == undefined) {
        	$('.power-msg').show();
        	$('.power-msg').text('请选择用户权限！');
            return;
        }else{
        	$('.power-msg').hide();
        }
        if ($('#main_type:checked').val() == undefined) {
        	$('.main-type-msg').show();
        	$('.main-type-msg').text('请选择用户属性！');
            return;
        }else{
        	$('.main-type-msg').hide();
        }
        if ($('#hp').val() < 0 || $('#hp').val().length >10) {
        	$('.hp-msg').show();
        	$('.hp-msg').text('必须大于等于0且不能超过10位！');
            return;
        }else{
        	$('.hp-msg').hide();
        }
        if ($('#ll').val() < 0 || $('#ll').val().length >10) {
        	$('.ll-msg').show();
        	$('.ll-msg').text('必须大于等于0且不能超过10位！');
            return;
        }else{
        	$('.ll-msg').hide();
        }
        if ($('#mj').val() < 0 || $('#mj').val().length >10) {
        	$('.mj-msg').show();
        	$('.mj-msg').text('必须大于等于0且不能超过10位！');
            return;
        }else{
        	$('.mj-msg').hide();
        }
        if ($('#zl').val() < 0 || $('#zl').val().length >10) {
        	$('.zl-msg').show();
        	$('.zl-msg').text('必须大于等于0且不能超过10位！');
            return;
        }else{
        	$('.zl-msg').hide();
        }
        if ($('#get_money').val() < 0 || $('#get_money').val().length >10) {
        	$('.get-money-msg').show();
        	$('.get-money-msg').text('必须大于等于0且不能超过10位！');
            return;
        }else{
        	$('.get-money-msg').hide();
        }
    	$('.form-horizontal').submit();
    }
    </script>
</body>

</html>